﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogic;
using System.Data;

namespace Website
{
    public partial class Book : System.Web.UI.Page
    {
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string bookID = GetParamsIdInUrl();
                BindGrid(bookID);
            }
        }
        protected string GetParamsIdInUrl()
        {
            return Request.QueryString["bookid"];
        }
        private void BindGrid(string bookID)
        {
            GridView1.DataSource = GridDataSource(bookID);
            GridView1.DataBind();
        }
        private DataTable GridDataSource(string bookID)
        {
            BookTrackManager pBTM = new BookTrackManager();
            DataTable dTable = new DataTable();
            try
            {
                dTable = pBTM.LoadByBookID(bookID);
            }
            catch (Exception ee)
            {
                //   lblMessage.Text = ee.Message.ToString();
            }
            finally
            {
                pBTM = null;
            }

            return dTable;
        }  
    }
}